package com.example.wordapp.mapper;

import com.example.wordapp.pojo.Comments;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentsMapper {

    //查询所有留言
    @Select("select id, text, user_id, create_time, update_time from comments")
    List<Comments> findAll();

    //增加留言
    @Insert("insert into comments values(null, #{text}, #{userId}, now(), now())")
    int addComments(Comments comments);
}
